package com.pms.init;

import org.springframework.stereotype.Component;

import com.espirit.eap.manager.ModelBuilderSupport;
import com.espirit.eap.pagelayout.Element;
import com.espirit.eap.pagelayout.ModelField;
import com.pms.manager.AdjustChargeItem;

@Component
public class AdjustChargeItemBuilder extends ModelBuilderSupport {

	static final String NAME = "name";
	static final String REMARK = "remark";
	
	@Override
	public boolean init() {
		return super.setClass(AdjustChargeItem.class, "Adjust Charge Item", "调整收费项目");
	}

	@Override
	public void buildFields() {
		addModelField(NAME, "Name", "名称");
		addModelField(REMARK, "Remark", "说明");
	}
	
	@Override
	public void prepareLayoutElements() {
		super.prepareLayoutElements();
	}
	
	
	@Override
	protected void setDefaultLayoutButtons() {
		super.setDefaultLayoutButtons();
	}
	
	@Override
	protected void addSearchFields() {
		super.addSearchField(convertPropertyToField(NAME));
	}
	
	@Override
	protected void addListFields() {
		addListField(convertPropertyToField(NAME, REMARK));
	}
	
	@Override
	protected void addDetailFields() {
		addDetailField(convertPropertyToField(NAME, REMARK));
	}
	
	@Override
	protected Element convertFieldToElement(ModelField mf, boolean isListLayout) {
		Element element = super.convertFieldToElement(mf, isListLayout);
		return element;
	}
	
	@Override
	protected void gatherExproperties() {
		exProperties.put(REQUIRED, new String[]{NAME});
	}
}
